<?php
	$SysTime = date("Y-m-d H:i:s");
	
	if (isset($_POST['AddRequest'])) {

	$QOperation = "INSERT INTO ccenter_requests
			(RefUser, RefOffice, RefDomain, Status, TimeCreated)
			VALUES
			({$_SESSION['UtID']},{$_SESSION['office']},0,0,'{$SysTime}')";
	$Action = $GLOBALS['CONN']->db_query($QOperation);
	
	} elseif (isset($_POST['UpdateRequest'])) {
	
	$QOperation = "UPDATE ccenter_requests
			SET Observations = '{$_POST['Observations']}',
			Status = 1
			WHERE Ref = {$_POST['Ref']}";
	$Action = $GLOBALS['CONN']->db_query($QOperation);
	
	} elseif (isset($_POST['AddArticle'])) {
	
	$QOperation = "INSERT INTO ccenter_requestarticles
			(RefArticle,RefRequest,Quantity,se,seTYPE)
			VALUES
			({$_POST['Article']},{$_POST['Ref']},'{$_POST['Quant']}',{$_POST['Use']},{$_POST['UseTYPE']})";
	$Action = $GLOBALS['CONN']->db_query($QOperation);
	
	} elseif (isset($_POST['RemRequest'])) {
	
	$QOperation = "UPDATE ccenter_requests
			SET Status = 5
			WHERE Ref = {$_POST['RemArticle']}";
	$Action = $GLOBALS['CONN']->db_query($QOperation);
	
	}
	if (isset($Action)) {
		$Msg_OPCONFIRM = "Opera��o Executada.";
		} elseif (isset($_POST['UpdateRequest'])) {
		$Msg_ERROR = "Erro, n�o foi poss�vel conclu�r a opera��o.";
		}
?>